import React, { useEffect, useState } from 'react'
import { unmountComponentAtNode } from 'react-dom';

export default function App() {
  let [src,setSrc]=useState(1)
  useEffect(()=>{
    const id=setInterval(() => {
      src+=1
    if(src>4){
      src=1
    }
    setSrc(src)
    }, 100);
    return ()=>{
      
      clearInterval(id)
    }
  },[])
  
  return (
    <div className="div">
    <img src={'/'+src+'.jpg'} alt=""/>
    </div>
  )
}
